/* test_terminal.cc
* This file is part of ncursesxx library
* Copyright (c) 2003,2004 by Stanislav Ievlev
*
* This file is covered by the GNU Library General Public License,
* which should be included with libncursesxx as the file COPYING.
*/
#include <iostream>
#include <stdexcept>
#include <string.h>
#include <unistd.h>

#include <ncurses/terminal.hh>
#include <ncurses/assert.hh>

int
main()
{
	try
	{
		ncurses::terminal::buffer_type buf(STDOUT_FILENO, std::ios_base::out, false, BUFSIZ);
		ncurses::terminal term(buf);

		std::cout << "maximum number of colors:" << term.colors_num() << std::endl;

		buf.sputn(" normal", strlen(" normal"));
		term.set_fg(COLOR_BLUE, A_UNDERLINE);
		buf.sputn(" blue underline", strlen(" blue underline"));

		term.set_fg_color(COLOR_RED);
		buf.sputn(" red underline", strlen(" red underline"));
		term.set_fg(COLOR_RED, A_NORMAL);
		buf.sputn(" red normal", strlen(" red normal"));

		buf.sputn("\n", 1);
	}
	catch (ncurses::runtime_error& e)
	{
		std::cout << "catch:" << e.what() << std::endl;
	}
}
